package cn.factorybox.common.entity;

import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * @author flypig
 * @version 1.0
 * @date 2020-03-04 10:41
 * 分页类
 */
public class PageResult<T> {

    private Long total;
    private Integer totalPage;
    private List<T> data;

    public PageResult() {
    }

    public PageResult(List<T> data) {
        this.data = data;
        PageInfo pageInfo = new PageInfo(data);
        this.total = pageInfo.getTotal();
    }

    public PageResult(Long total, List<T> data) {
        this.total = total;
        this.data = data;
    }

    public PageResult(Long total, Integer totalPage, List<T> data) {
        this.total = total;
        this.totalPage = totalPage;
        this.data = data;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getdata() {
        return data;
    }

    public void setdata(List<T> data) {
        this.data = data;
    }
}
